package com.wyx.suanfa;

/**
 * @author 王艺锡
 * @version 1.0
 */
public class removeDuplicates {
    public static void main(String[] args) {


    }
}
/*
* class Solution {
    public String removeDuplicates(String s) {
        //ArrayDeque会比LinkedList在除了删除元素这一点外会快一点
        ArrayDeque<Character> deque = new ArrayDeque<>();
        char ch;
        for(int i = 0;i<s.length();i++){
            ch = s.charAt(i);
            //如果栈为空或者栈头元素不能与当前元素，就把当前元素入栈
            if(deque.isEmpty() || ch != deque.peek()){
                deque.push(ch);
            }else{//栈头元素等于当前元素,把栈头元素出栈
                deque.pop();
            }

        }

            String str = "";
            while(!deque.isEmpty()){//如果栈不为空
                str = deque.pop() + str;
            }
         return str;


    }
}*/
